class Solution {
public:
    int subsetXORSum(vector<int>& nums)
    {
        int ans = 0;
        int path = 0;
        function<void(int)> dfs = [&](int i) {
            ans += path;
            for (int j = i; j < nums.size(); j++)
            {
                path ^= nums[j];
                dfs(j + 1);
                path ^= nums[j];
            }
            };
        dfs(0);
        return ans;
    }
};